home *** CD-ROM | disk | FTP | other *** search
Text File | 1995-11-17 | 4.7 KB | 165 lines | [TEXT/CWIE] |
- // ===========================================================================
- // <CGI Starter Source>.cp ©1995 Brian Todoroff All rights reserved.
- // Portions ©1994-1995 Metrowerks Inc. All rights reserved.
- // ===========================================================================
- //
- // This file contains the starter code for a PowerPlant CGI application
- // that is compatible with the calling conventions of MacHTTP and WebSTAR.
- //
- // Much of what you find here comes from the CW7 <PP Starter Source>
-
- #include "<CGI Starter Header>.h"
-
- #include <LGrowZone.h>
- #include <LWindow.h>
- #include <PP_Messages.h>
- #include <PP_Resources.h>
- #include <PPobClasses.h>
- #include <UDrawingState.h>
- #include <UMemoryMgr.h>
- #include <URegistrar.h>
- #include <LEditField.h>
-
- // ===========================================================================
- // • Main Program
- // ===========================================================================
-
- void main(void)
- {
- // Set Debugging options
- SetDebugThrow_(debugAction_Alert);
- SetDebugSignal_(debugAction_Alert);
-
- InitializeHeap(3); // Initialize Memory Manager
- // Parameter is number of Master Pointer
- // blocks to allocate
-
- // Initialize standard Toolbox managers
- UQDGlobals::InitializeToolbox(&qd);
-
- new LGrowZone(20000); // Install a GrowZone function to catch
- // low memory situations.
-
- CGIStarterApp theApp; // replace this with your App type
- theApp.Run();
- }
-
-
- // ---------------------------------------------------------------------------
- // • CPPStarterApp // replace this with your App type
- // ---------------------------------------------------------------------------
- // Constructor
-
- CGIStarterApp::CGIStarterApp()
- {
- // Register functions to create core PowerPlant classes
-
- RegisterAllPPClasses();
- }
-
-
- // ---------------------------------------------------------------------------
- // • ~CPPStarterApp // replace this with your App type
- // ---------------------------------------------------------------------------
- // Destructor
- //
-
- CGIStarterApp::~CGIStarterApp()
- {
- }
-
- // ---------------------------------------------------------------------------
- // • StartUp
- // ---------------------------------------------------------------------------
- // This function lets you do something when the application starts up.
- // For example, you could issue your own new command, or respond to a system
- // oDoc (open document) event.
-
- void
- CGIStarterApp::StartUp()
- {
- }
-
- // ---------------------------------------------------------------------------
- // • ObeyCommand
- // ---------------------------------------------------------------------------
- // Respond to commands
-
- Boolean
- CGIStarterApp::ObeyCommand(
- CommandT inCommand,
- void *ioParam)
- {
- Boolean cmdHandled = true;
-
- switch (inCommand) {
-
- // Deal with command messages (defined in PP_Messages.h).
- // Any that you don't handle will be passed to LApplication
-
- default:
- cmdHandled = LApplication::ObeyCommand(inCommand, ioParam);
- break;
- }
-
- return cmdHandled;
- }
-
- // ---------------------------------------------------------------------------
- // • FindCommandStatus
- // ---------------------------------------------------------------------------
- // This function enables menu commands.
- //
-
- void
- CGIStarterApp::FindCommandStatus(
- CommandT inCommand,
- Boolean &outEnabled,
- Boolean &outUsesMark,
- Char16 &outMark,
- Str255 outName)
- {
-
- switch (inCommand) {
-
- // Return menu item status according to command messages.
- // Any that you don't handle will be passed to LApplication
-
- default:
- LApplication::FindCommandStatus(inCommand, outEnabled,
- outUsesMark, outMark, outName);
- break;
- }
- }
-
- void CGIStarterApp::HandleCGICall(struct CGIData &data,LCHandleStream &sout)
- {
- sout<<"This is being served from the GCI++ Framework by Brian Todoroff"<<endl;
- sout<<endl;
- sout<<"You must change the HandleCGICall routine in your application."<<endl;
- sout<<endl;
- sout<<"The data recived is "<<endl;
- sout<<"direct: "<<data.direct<<endl;
- sout<<"search: "<<data.search<<endl;
- sout<<"uname: "<<data.uname<<endl;
- sout<<"pass: "<<data.pass<<endl;
- sout<<"fromuser:"<<data.fromuser<<endl;
- sout<<"caddr: "<<data.caddr<<endl;
- sout<<"post: "<<data.post<<endl;
- sout<<"method: "<<data.method<<endl;
- sout<<"sname: "<<data.sname<<endl;
- sout<<"sport: "<<data.sport<<endl;
- sout<<"cginame: "<<data.cginame<<endl;
- sout<<"ctype: "<<data.ctype<<endl;
- sout<<"referer: "<<data.referer<<endl;
- sout<<"agent: "<<data.agent<<endl;
- sout<<endl;
- sout<<"<H3>That's It For Now!</H3>"<<endl;
- sout<<endl<<"Based on the CGI++ Framework for PowerPlant"<<endl;
- sout<<"Contact the author at: btodorof@hmc.edu"<<endl;
- sout<<"Bug reports and suggestions appreciated."<<endl;
-
- return;
- }
-
-